#-*- coding: utf-8 -*-
from gi.repository import Nautilus, GObject
import os

class ColumnExtension(GObject.GObject, Nautilus.MenuProvider):
    def __init__(self):
        pass
        
    def menu_activate_cb(self, window, files):
        import sys
        sys.path.append("/home/gbf/nautilus-id3extract/src")
        import base
        base.main(files[0].get_name())
        
    def get_file_items(self, window, files):
        # Just apply to 1 item and if this item be a zip file
        if len(files) != 1 :
            return
           
        ext = os.path.splitext(files[0].get_name())[1]
         
        if ext != '.zip' :
            return
            
        
        item = Nautilus.MenuItem(
            name="Extrair::",
            label="Extrair e tagear",
            tip="Extrair e renomear as tags"
        )
        item.connect('activate', self.menu_activate_cb, files)

        return [item]
